package com.amikomgamedev.labirinhantu.grafik;

import org.andengine.engine.camera.ZoomCamera;
import org.andengine.engine.camera.hud.HUD;
import org.andengine.entity.scene.Scene;

import android.content.Context;

import com.amikomgamedev.labirinhantu.Server_Data;
import com.amikomgamedev.labirinhantu.Utils;



public class Grafik_Detach 	extends Grafik_Attach
{
	public Grafik_Detach(Context context
			, Scene p_Scene
			, HUD p_Hud
			, ZoomCamera p_Camera)
	{
		super(context, p_Scene, p_Hud, p_Camera);
	}

	public void detachLogo(int index)
	{
	   
		spr_Logo[index].detachSelf();
	   
	}
	
	public void detachMenuMainBg()
	{
		spr_Menu_Main_Bg.detachSelf();
		spr_LogoHantu.detachSelf();
		asp_Menu_Lonceng.detachSelf();
		spr_Menu_Mc_Bernafas.detachSelf();
		
	}
	
	public void detachMenuSelectStage()
	{
		for(int i=0; i<MENU_SELECT_STAGE_BG.length;i++)
			spr_Menu_Select_Stage[i].detachSelf();
	}
	
	public void detachMenuStageLingkaran()
	{

		while (lst_Menu_Stage_Lingkaran.size() != 0)
		{
		    lst_Menu_Stage_Lingkaran.get(lst_Menu_Stage_Lingkaran.size() - 1).detachSelf();
		    lst_Menu_Stage_Lingkaran.remove(lst_Menu_Stage_Lingkaran.size() - 1);
		}
	}
	
	public void detachMenuLevelLingkaran()
	{

		while (lst_Menu_Level_Lingkaran.size() != 0)
		{
		    lst_Menu_Level_Lingkaran.get(lst_Menu_Level_Lingkaran.size() - 1).detachSelf();
		    lst_Menu_Level_Lingkaran.remove(lst_Menu_Level_Lingkaran.size() - 1);
		}
	}
	
	public void detachBtnMenuSelectStage()
	{
		for(int i=0; i<2; i++)
			spr_Btn_Menu_Select_Stage[i].detachSelf();
	}
	
	public void detachMenuMainBtn()
	{		
		for (int i = 0; i < MENU_MAIN_BTN.length; i++)
			spr_Menu_Main_Btn[i].detachSelf();
	}
	
	public void detachMenuLevelBg()
	{	    
		spr_Menu_Level_Bg.detachSelf();
	}
	
	public void detachMenuLevelBtn()
	{
//	    	spr_Menu_Level_Btn[0][0].detachSelf();
	    	
		for (int i = 0; i < MAP[Server_Data.getStage()].length; i++)
			spr_Menu_Level_Btn[i].detachSelf();
	}
	
	public void detachMenuLevel()
	{
		while (lst_Menu_Level_Btn_Gembok.size() != 0)
		{
		    lst_Menu_Level_Btn_Gembok.get(lst_Menu_Level_Btn_Gembok.size() - 1).detachSelf();
		    lst_Menu_Level_Btn_Gembok.remove(lst_Menu_Level_Btn_Gembok.size() - 1);
		}
		
		for (int i = 0; i < MAP[Server_Data.getStage()].length; i++)
		{
		    for (int j = 0; j < 3; j++)
		    {
			if (spr_Menu_Level_Btn_Tulang[i][j] != null)
			    spr_Menu_Level_Btn_Tulang[i][j].detachSelf();
		    }
		}
	}
	
	public void detachMenuCreditsBg()
	{
		spr_Menu_Credits_Bg.detachSelf();
	}
	
//	public void detachMenuHelpBg()
//	{
//		spr_Menu_Help_Bg.detachSelf();
//	}
	
	public void detachMenuHelp()
	{
		for(int i=0; i<spr_Menu_Help.length;i++)
		{
		    	spr_Menu_Help[i].detachSelf();
		}
	}
	
	public void detachGamePlayBg()
	{
	    	rec_Game_Play_Bg.detachSelf();
		tmx_Layer_Game_Play.detachSelf();
	}
	
	public void detachGamePlayMc()
	{
	    for (int i = 0; i < 2; i++)
	    {
		spr_Game_Play_Mc[i].detachSelf();
		
	    }
	}
	
	public void detachGamePlayBtn()
	{
		for (int i = 0; i < GAME_PLAY_BTN_ARROW.length; i++)
			spr_Game_Play_Btn[i].detachSelf();
		
		while (lst_Game_Play_Btn.size() != 0)
		{
		    lst_Game_Play_Btn.get(lst_Game_Play_Btn.size() - 1).detachSelf();
		    lst_Game_Play_Btn.remove(lst_Game_Play_Btn.size() - 1);
		}
		
	}
	
	public void detachGamePlayFloat()
	{
		while (lst_Game_Play_Float.size() != 0)
			detachGamePlayFloat(lst_Game_Play_Float.size() - 1);
	}
	
	public void detachGamePlayFloat(int index)
	{
		lst_Game_Play_Float.get(index).detachSelf();
		lst_Game_Play_Float.remove(index);
	}
	
	public void detachGamePlayGhost()
	{
	    while (lst_Game_Play_Ghost.size() != 0)
		{
			lst_Game_Play_Ghost.get(lst_Game_Play_Ghost.size() - 1).detachSelf();
			lst_Game_Play_Ghost.remove(lst_Game_Play_Ghost.size() - 1);
		}
	    while (lst_Game_Play_Ghost_Invisible.size() != 0)
		{
		lst_Game_Play_Ghost_Invisible.get(lst_Game_Play_Ghost_Invisible.size() - 1).detachSelf();
		lst_Game_Play_Ghost_Invisible.remove(lst_Game_Play_Ghost_Invisible.size() - 1);
		}
	}
	
	public void detachGamePlayCollection()
	{
		while (lst_Game_Play_Collection.size() != 0)
			detachGamePlayCollection(lst_Game_Play_Collection.size() - 1);
	}
	
	public void detachGamePlayCollection(int index)
	{
		lst_Game_Play_Collection.get(index).detachSelf();
		lst_Game_Play_Collection.remove(index);
	}
	
	public void detachGamePlayItemRight()
	{
		while (lst_Game_Play_Item_Right.size() != 0)
		    detachGamePlayItemRight(lst_Game_Play_Item_Right.size() - 1);
	}
	
	public void detachGamePlayItemRight(int index)
	{
	    lst_Game_Play_Item_Right.get(index).detachSelf();
	    lst_Game_Play_Item_Right.remove(index);
	}
	
	public void detachGamePlayItemLeft()
	{
		while (lst_Game_Play_Item_Left.size() != 0)
		    detachGamePlayItemLeft(lst_Game_Play_Item_Left.size() - 1);
	}
	
	public void detachGamePlayItemLeft(int index)
	{
	    lst_Game_Play_Item_Left.get(index).detachSelf();
	    lst_Game_Play_Item_Left.remove(index);
	}
	
	public void detachGamePlayFire()
	{
	    while (lst_Game_Play_Fire.size() != 0)
		{
			lst_Game_Play_Fire.get(lst_Game_Play_Fire.size() - 1).detachSelf();
			lst_Game_Play_Fire.remove(lst_Game_Play_Fire.size() - 1);
		}
	    while (lst_rec_Game_Play_Fire.size() != 0)
		{
		lst_rec_Game_Play_Fire.get(lst_rec_Game_Play_Fire.size() - 1).detachSelf();
		lst_rec_Game_Play_Fire.remove(lst_rec_Game_Play_Fire.size() - 1);
		}
	}
	
	public void detachGamePlayMist()
	{
		while (lst_Game_Play_Mist.size() != 0)
		{
			lst_Game_Play_Mist.get(lst_Game_Play_Mist.size() - 1).detachSelf();
			lst_Game_Play_Mist.remove(lst_Game_Play_Mist.size() - 1);
		}
	}
	
	public void detachGamePlayWall()
	{
		while (lst_Game_Play_Wall.size() != 0)
		{
			lst_Game_Play_Wall.get(lst_Game_Play_Wall.size() - 1).detachSelf();
			lst_Game_Play_Wall.remove(lst_Game_Play_Wall.size() - 1);
		}
	}
	
	public void detachGamePlayWater()
	{
		while (lst_Game_Play_Water.size() != 0)
		{
			lst_Game_Play_Water.get(lst_Game_Play_Water.size() - 1).detachSelf();
			lst_Game_Play_Water.remove(lst_Game_Play_Water.size() - 1);
		}
	}
	
	public void detachGamePlayMoveGhost()
	{
	    while (lst_Game_Play_Move_Ghost.size() != 0)
		{
        		lst_Game_Play_Move_Ghost.get(lst_Game_Play_Move_Ghost.size() - 1).detachSelf();
        		lst_Game_Play_Move_Ghost.remove(lst_Game_Play_Move_Ghost.size() - 1);
		}
	}
	
	public void detachGamePlayBtnGhost()
	{
		while (lst_Game_Play_Btn_Ghost.size() != 0)
		{
			lst_Game_Play_Btn_Ghost.get(lst_Game_Play_Btn_Ghost.size() - 1).detachSelf();
			lst_Game_Play_Btn_Ghost.remove(lst_Game_Play_Btn_Ghost.size() - 1);
		}
	}
	
	public void detachGamePlayBtnMist()
	{
		while (lst_Game_Play_Btn_Mist.size() != 0)
		{
			lst_Game_Play_Btn_Mist.get(lst_Game_Play_Btn_Mist.size() - 1).detachSelf();
			lst_Game_Play_Btn_Mist.remove(lst_Game_Play_Btn_Mist.size() - 1);
		}
	}
	
	public void detachGamePlayFinish()
	{
		while (lst_Game_Play_Finish.size() != 0)
		{
			lst_Game_Play_Finish.get(lst_Game_Play_Finish.size() - 1).detachSelf();
			lst_Game_Play_Finish.remove(lst_Game_Play_Finish.size() - 1);
		}
	}
	
	public void detachGamePlayTaskbar()
	{
	    spr_Game_Play_Taskbar_Bg.detachSelf();
	    spr_Game_Play_TaskBar_Mc.detachSelf();
	    spr_Game_Play_TaskBar_Btn.detachSelf();
	    
	    while (lst_Game_Play_Taskbar_Rule.size() != 0)
		{
			lst_Game_Play_Taskbar_Rule.get(lst_Game_Play_Taskbar_Rule.size() - 1).detachSelf();
			lst_Game_Play_Taskbar_Rule.remove(lst_Game_Play_Taskbar_Rule.size() - 1);		    
		}
	}
	
	public void detachGamePlayRuleCoin()
	{
	    for (int i = 0; i < lst_Game_Play_Taskbar_Rule.size(); i++)
	    {
		Utils.TRACE("lst_Game_Play_Taskbar_Rule = " + lst_Game_Play_Taskbar_Rule);
		Utils.TRACE("i = " + i);
		

		if (lst_Game_Play_Taskbar_Rule.get(i).getUserData() != null)
        		if (lst_Game_Play_Taskbar_Rule.get(i).getUserData().equals("Koin"))
        		{
               			lst_Game_Play_Taskbar_Rule.get(i).setVisible(false);
        		}
	    }
	}
	
	public void detachGamePause()
	{
		spr_Game_Pause_Bg.detachSelf();
		
		while (lst_Game_Pause_Btn.size() != 0)
		{
		    lst_Game_Pause_Btn.get(lst_Game_Pause_Btn.size() - 1).detachSelf();
		    lst_Game_Pause_Btn.remove(lst_Game_Pause_Btn.size() - 1);		    
		}
		
	}
	
	public void detachGameOver()
	{
	    	while (lst_Game_Over_Bg.size() != 0)
		{
    	    		lst_Game_Over_Bg.get(lst_Game_Over_Bg.size() - 1).detachSelf();
    	    		lst_Game_Over_Bg.remove(lst_Game_Over_Bg.size() - 1);		    
		}
		spr_Game_Over_MC.detachSelf();
		spr_Game_Over_Darah.detachSelf();
		spr_Game_Over_Txt.detachSelf();
		spr_Icon_Social_Game.detachSelf();
		while (lst_Game_Over_Btn.size() != 0)
		{
		    	lst_Game_Over_Btn.get(lst_Game_Over_Btn.size() - 1).detachSelf();
		    	lst_Game_Over_Btn.remove(lst_Game_Over_Btn.size() - 1);
		}
	}
	
	public void detachGameWin()
	{
	    	while (lst_Game_Win_Bg.size() != 0)
		{
    	    		lst_Game_Win_Bg.get(lst_Game_Win_Bg.size() - 1).detachSelf();
    	    		lst_Game_Win_Bg.remove(lst_Game_Win_Bg.size() - 1);		    
		}
		spr_Game_Win_Mc.detachSelf();
		spr_Game_Win_Txt.detachSelf();
		while (lst_Game_Win_Btn.size() != 0)
		{
		    lst_Game_Win_Btn.get(lst_Game_Win_Btn.size() - 1).detachSelf();
		    lst_Game_Win_Btn.remove(lst_Game_Win_Btn.size() - 1);
		}
		while (lst_Game_Win_Tulang.size() != 0)
		{
		    lst_Game_Win_Tulang.get(lst_Game_Win_Tulang.size() - 1).detachSelf();
		    lst_Game_Win_Tulang.remove(lst_Game_Win_Tulang.size() - 1);
		}
		
	}
	
//	public void detachGameWinBg()
//	{
//		spr_Game_Win_Bg.detachSelf();
//	}
}
